package cn.com.dhcc.adam.spring.mvc.one;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@Controller
@RequestMapping("/info")
public class PersonController {

	@Autowired(required=true)
	@Qualifier("PersonInfoServiceImplDefault")
	public PersonInfoService personInfoService;

	@RequestMapping(value = "/basic/{personID}")
	public String basicInfo(@PathVariable String personID, Model mode) {
		mode.addAttribute("message", personInfoService.basicInfo(personID));
		return "basic";
	}

	@RequestMapping(value="/helloWorld")
	public String helloWorld(Model model) {
		model.addAttribute("message", "Hello World!");
		return "helloworld";
	}
	@RequestMapping(value="/baidu")
	public String rBaidu(){
		return "redirect:http://baidu.com";
	}
	
	@RequestMapping(value="/subcom")
	public String subJSP(){
		return "sub/com";
	}
}
